{include file="public/nheader"}
<style type="text/css">
    #lay-tableList {
        height: auto;
    }
</style>
<style type="text/css">
    .layui-table-view .layui-table[lay-size=lg] .layui-table-cell {
        height: auto;
    }
</style>
<div class="layui-fluid">
    <div class="layui-card">
        <!-- // 默认操作按钮 -->
        <div class="layui-card-header layadmin-card-header-auto ">
            <div class="layui-form">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <div class="layui-input-inline ">
                            <input value="{:input('get.created')}" name="created" lay-datetime=""
                                data-format="yyyy-MM-dd" data-range="~" data-type="date" class="layui-input" type="text"
                                placeholder="线索获取日期数据筛选" />
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline ">
                            <select name="adv_id" lay-verify="">
                                <option value="">运营人员(即adv_id查找)</option>
                                {foreach $laiyuan as $pp}
                                <option value="{$pp.ly}" {if !empty(input('get.ly')) &&
                                    input('get.type')==$pp.ly}selected{/if}>{$pp.yyname}(Adv_id:{$pp.ly})</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline ">
                            <select name="type" lay-verify="">
                                <option value="">品牌</option>
                                {foreach $pinpai as $pp}
                                <option value="{$pp.type}" {if !empty(input('get.type')) &&
                                    input('get.type')==$pp.type}selected{/if}>{$pp.pinpai}</option>
                                {/foreach}
                            </select>
                        </div>
                    </div>
                    <div class="layui-inline">
                        <div class="layui-input-inline ">
                            <input name="videoid" class="layui-input" type="text" placeholder="videoID查找" />
                        </div>
                    </div>
                    <div class="layui-inline">
                        <!-- // 默认搜索 -->
                        <button class="layui-btn icon-btn" lay-filter="formSearch" lay-submit>搜索</button>
                    </div>
                </div>
            </div>
        </div>
        <!-- // 创建数据实例 -->
        <table id="lay-tableList" lay-filter="lay-tableList"></table>
    </div>
</div>
<!-- // 列表工具栏 -->
<script type="text/html" id="tableBar">
    <a class="layui-table-text" style="color:#FF5722" data-url="/lista/lista_status?id={{d.id}}&status=isdel" data-reload="self" data-confirm="" lay-ajax="">删除</a>
</script>
{include file="public/nfooter"}
<script>
    layui.use(['admin', 'layer', 'table', 'form', 'upload'], function () {
        var admin = layui.admin;
        var layer = layui.layer;
        var table = layui.table;      // 表格
        var form = layui.form;
        var upload = layui.upload;
        //执行实例
        var uploadInst = upload.render({
            elem: '#excels' //绑定元素
            , accept: 'file'
            , url: '/admin/import_phone' //上传接口
            , before: function (obj) { //obj参数包含的信息，跟 choose回调完全一致，可参见上文。
                layer.load(); //上传loading
            }
            , done: function (res) {
                layer.closeAll('loading'); //关闭loading
                //如果上传失败
                if (res.status == 0) {
                    var str = '';
                    $.each(res.data, function (i, obj) {
                        console.log(i, obj);
                        str += '<div>' + obj + '</div>';
                    });
                    layer.open({
                        type: 0,
                        content: str,
                        yes: function () {
                            location.reload();
                        }
                    });
                    return false;
                } else {
                    layer.msg(res.msg, { icon: 2, time: 1000 });
                    return false;
                }
            }
            , error: function () {
                layer.closeAll('loading'); //关闭loading
                layer.msg('请求失败请重试', { icon: 2, time: 1000 });
                return false;

            }
        });
        /*
         * 初始化表格
        */
        var isTable = table.render({
            elem: "#lay-tableList"
            , url: "{:url()}"
            , page: true
            , size: 'lg'
            , where: {
                //created: "{:input('created',date('Y-m-d'))}",
            }
            , toolbar: 'true'
            // , defaultToolbar: ["filter","exports","print"]
            , defaultToolbar: [{
                title: '导出excel' //标题
                , layEvent: 'LAYTABLE_EXPORT' //事件名，用于 toolbar 事件中使用
                , icon: 'layui-icon-export' //图标类名
            }, {
                title: '打印页面' //标题
                , layEvent: 'LAYTABLE_PRINT' //事件名，用于 toolbar 事件中使用
                , icon: 'layui-icon-print' //图标类名
            }, {
                title: '筛选数据' //标题
                , layEvent: 'LAYTABLE_COLS' //事件名，用于 toolbar 事件中使用
                , icon: 'layui-icon-cols' //图标类名
            }]
            , even: true
            , loading: true
            , limits: [10, 20, 40, 60, 80, 100, 150, 200, 300, 100000]
            , limit: 10
            , cols: [[
                { type: 'checkbox', width: 60 },
                { field: 'pinpai', width: 150, align: 'center', title: '品牌名称' },
                { field: 'yunying', width: 150, align: 'center', title: '制作人' },
                { field: 'videoid', width: 200, align: 'center', title: '视频id' },
                { field: 'number', width: 150, align: 'center', title: '数量' },
                { field: 'youxiao', width: 150, align: 'center', title: '有效' },
                { field: 'wuxiao', width: 150, align: 'center', title: '无效' },
                { field: 'youxiaolv', width: 150, align: 'center', title: '有效率' },
            ]]
        })
    })
</script>